<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html PUBliC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<style> 
<!-- 
.tbw{
	  width:15%;
	}
	
.w3cbbs { page-break-after:always;}
	
--> 
</style>
</head>
<body>
  <!-------------------------------------------------------主体部分 ------------------------------------------------ -->

<table border=1 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stabDetail">
    <tr>
        <td align="center"  colspan="7">新星公司费用报销单</td>
    </tr>
    <tr >
       <td  colspan="7">
	       <table border=0 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stssabDetail">
	            <tr>
			        <td align="left" width="30%">基本信息</td>
			        <td align="right" >报账时间：</td>
			        <td align="right" >2013-4-1</td>
			        <td align="right" >NO：</td>
			        <td align="right" >BXSQ-20130401-0003</td>
			        <td align="right" >页码：</td>
			        <td align="right" >（1/3）</td>
		        </tr>
	        </table>
        </td>
    </tr>
    <tr >
        <td align="center" class="tbw">报销部门</td>
        <td align="left" >平台部</td>
        <td align="center" class="tbw">报销人</td>
        <td align="left"  >解佳俊</td>
        <td align="center" class="tbw">报销类型</td>
        <td align="left" colspan="2">差旅报销</td>
    </tr>
    <tr >
        <td align="center" class="tbw">报销事由</td>
        <td  colspan="6"></td>
    </tr>
    <tr >
        <td align="center" class="tbw">出差类型</td>
        <td align="left">工程实施</td>
        <td align="center" class="tbw">医院名称</td>
        <td align="left">郑州市第一人民医院</td>
        <td align="center" class="tbw">成本类型</td>
        <td align="left" colspan="2"></td>
    </tr>
     <tr >
        <td align="center" class="tbw">開始日期</td>
        <td align="left">2013-4-1 9:14</td>
        <td align="center" class="tbw">結束日期</td>
        <td align="left">2013-4-1 9:14</td>
        <td align="center" class="tbw">出差天數</td>
        <td align="left" colspan="2">1.00</td>
    </tr>
    <tr >
        <td align="center"class="tbw">基本补助金额</td>
        <td align="left" >30.0</td>
        <td align="center"class="tbw">餐费补助金额</td>
        <td align="left" >30.0</td>
        <td align="right" class="tbw">补助金额合计</td>
        <td align="left" colspan="2">60.0</td>
    </tr>
</table>
<div class="w3cbbs"></div>
  <!------------------------------------------------------- 明细部分 ------------------------------------------------ -->

<sql:setDataSource
         var="dataSrc"
         url="jdbc:mysql://localhost:3306/test?characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false"
         driver="com.mysql.jdbc.Driver"
         user="root"
         password="qwert01234"/>
<sql:query var="queryResults" dataSource="${dataSrc}">
      select * from chargeitem
</sql:query>
<table border=1 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stabDetail">
    <tr>
        <td align="center"  colspan="7">新星公司费用报销单</td>
    </tr>
    <tr >
       <td  colspan="7">
	       <table border=0 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stssabDetail">
	            <tr>
			        <td align="left" width="30%">费用信息</td>
			        <td align="right" >NO：</td>
			        <td align="right" >BXSQ-20130401-0003</td>
		        </tr>
	        </table>
        </td>
    </tr>
    </table>
    <table border=1 width="808" style="border-collapse:collapse;" align=center cellpadding=3 id="swtabDetail">
	        <tr>
				<td align="center">序号</td> 
				<td align="center">费用类别</td> 
				<td align="center">费用明细</td> 
				<td align="center">开始时间</td> 
				<td align="center">结束时间</td> 
				<td align="center">单据数</td> 
				<td align="center">金额（元）</td> 
				<td align="center">简要说明</td> 
		    </tr> 
			 <c:forEach var="row" items="${queryResults.rows}">
						  <c:choose>
						     <c:when test="${queryResults.rowCount >=5 && row.id%5 == 0}">
							    	<tr> 
										<td align="center">${row.id}</td> 
										<td align="left">${row.feetype}</td> 
										<td align="left">${row.feedetail}</td> 
										<td align="center"><fmt:formatDate value="${row.begindate}" type="date"/></td> 
										<td align="center"><fmt:formatDate value="${row.enddate}" type="date"/></td> 
										<td align="right">${row.papers}</td> 
										<td align="center">${row.fee}</td> 
										<td height="20">11111111</td> 
									</tr>
									</table>
									<div class="w3cbbs"></div>
									<table border=1 width="808" style="border-collapse:collapse;" align="center" cellpadding=3 id="stabDetail">
									    <tr>
									        <td align="center"  colspan="7">新星公司费用报销单</td>
									    </tr>
									    <tr >
									       <td  colspan="7">
										       <table border=0 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stssabDetail">
										            <tr>
												        <td align="left" width="30%">费用信息</td>
												        <td align="right" >NO：</td>
												        <td align="right" >BXSQ-20130401-0003</td>
											        </tr>
										        </table>
									        </td>
									    </tr>
									    </table>
									    <table border=1 width="808" style="border-collapse:collapse;" align=center cellpadding=3 id="swtabDetail">
										        <tr>
													<td align="center">序号</td> 
													<td align="center">费用类别</td> 
													<td align="center">费用明细</td> 
													<td align="center">开始时间</td> 
													<td align="center">结束时间</td> 
													<td align="center">单据数</td> 
													<td align="center">金额（元）</td> 
													<td align="center">简要说明</td> 
											    </tr> 
								 </c:when>
							    <c:when test="${queryResults.rowCount >=5 && row.id%5 != 0}">
									<tr> 
										<td align="center">${row.id}</td> 
										<td align="left">${row.feetype}</td> 
										<td align="left">${row.feedetail}</td> 
										<td align="center"><fmt:formatDate value="${row.begindate}" type="date"/></td> 
										<td align="center"><fmt:formatDate value="${row.enddate}" type="date"/></td> 
										<td align="right">${row.papers}</td> 
										<td align="center">${row.fee}</td> 
										<td >22222222</td> 
									</tr>
						      </c:when>
						     <c:otherwise>
						        	 <tr> 
										<td align="center">${row.id}</td> 
										<td align="left">${row.feetype}</td> 
										<td align="left">${row.feedetail}</td> 
										<td align="center"><fmt:formatDate value="${row.begindate}" type="date"/></td> 
										<td align="center"><fmt:formatDate value="${row.enddate}" type="date"/></td> 
										<td align="right">${row.papers}</td> 
										<td align="center">${row.fee}</td> 
										<td >22222222</td> 
									</tr>
						     </c:otherwise>
						  </c:choose>
				</c:forEach>
				<c:choose>
				  	 <c:when test="${queryResults.rowCount%5!=0 }">
				  	 				<c:forEach var="i" begin="1" end="${5-queryResults.rowCount%5}" step="1">
				  	 				 <tr> 
										<td align="center">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td align="center">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td align="center">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td align="right">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td align="center">&nbsp;&nbsp;&nbsp;&nbsp;</td> 
										<td>&nbsp;&nbsp;&nbsp;&nbsp;</td> 
									</tr>
									</c:forEach>
                     </c:when>
				</c:choose>
				<tr> 

										<td align="right" colspan="7">合计：</td> 
										<td align="right"> 总金额</td> 
										</tr>
  </table>
  <div class="w3cbbs"></div>
  <!------------------------------------------------------- 签字部分 ------------------------------------------------ -->
<table border=1 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stabDetail">
    <tr>
        <td align="center"  colspan="7">新星公司费用报销单</td>
    </tr>
    <tr >
       <td  colspan="7">
	       <table border=0 width="800" style="border-collapse:collapse;" align="center" cellpadding=3 id="stssabDetail">
	            <tr>
			        <td align="left" width="30%">基本信息</td>
			        <td align="right" >报账时间：</td>
			        <td align="right" >2013-4-1</td>
			        <td align="right" >NO：</td>
			        <td align="right" >BXSQ-20130401-0003</td>
			        <td align="right" >页码：</td>
			        <td align="right" >（1/3）</td>
		        </tr>
	        </table>
        </td>
    </tr>
    <tr >
        <td align="center" class="tbw">原借款金额</td>
        <td align="left" >平台部</td>
        <td align="center" class="tbw">应报金额</td>
        <td align="left"  >解佳俊</td>
        <td align="center" class="tbw">实报金额</td>
        <td align="left" colspan="2">差旅报销</td>
    </tr>
    <tr >
        <td align="center" class="tbw">金额大写</td>
        <td  colspan="6"></td>
    </tr>
    <tr >
        <td align="center" class="tbw">报账人签字</td>
        <td align="left">工程实施</td>
        <td align="center" class="tbw">主管签字</td>
        <td align="left">郑州市第一人民医院</td>
        <td align="center" class="tbw">核算会计签字</td>
        <td align="left" colspan="2"></td>
    </tr>
     <tr >
        <td align="center" class="tbw">出纳签字</td>
        <td align="left">2013-4-1 9:14</td>
        <td align="center" class="tbw">财务总监签字</td>
        <td align="left">2013-4-1 9:14</td>
        <td align="center" class="tbw">收款人签字</td>
        <td align="left" colspan="2">1.00</td>
    </tr>
</table>				
</body>
</html>